#ifndef SWP_END_POINT_GRAPHIC_ITEM_H
#define SWP_END_POINT_GRAPHIC_ITEM_H

#include "abstractellipsegraphicitem.h"

#include <igraphicitemcontent.h>

namespace swp
{

class SwpEndPointGraphicItem : public AbstractEllipseGraphicItem
{
private:
    class Content : public EllipseGraphicItem,
        public core::IGraphicItemContent
    {
    public:
        Content(QGraphicsItem* parent = 0);
        ~Content();

        // IGraphicItemContent
        QGraphicsItem* graphicsItem() const;
        void drawThumbnail(QPainter& painter,
            const QRectF& boundingRect);
        QRectF croppedBoundingRect() const;
        void recheckIfFits();
        void setPalette(const core::Palette* const palette);

        // ISerializable
        bool doActionForProperty(const QString& property,
            const QVariantList& value, const core::SerializationEngine& helper);
        void deserializationFinished(bool ok);
        QHash<QString, QVariantList> serializationData(
            const core::SerializationEngine& helper) const;
    };

public:
    SwpEndPointGraphicItem(QGraphicsItem* parent = 0);
    virtual ~SwpEndPointGraphicItem();

    int paletteType() const;

    // IEditorItem
    virtual bool supportsConnection(
        const core::ConnectionData& connection) const;

    virtual int type() const;

    QString name() const;

    virtual IEditorItem* copy() const;

    // IPropertyObject
    QList<core::Property> properties() const;

    QVariant propertyValue(const QString& propertyName) const;

    void propertyChanged(const QString& property,
        const QVariant& newValue, bool silent = false);

    QVariantList optionList(const QString& propertyName) const;
    QVariantList autocomplete(const QString& propertyName) const;

protected:
    // AbstractEllipseGraphicItem
    QList<QPointF> scalePoints() const;
    QList<QPointF> connectPoints() const;
    QList<QPointF> selfConnectAnchorPoints() const;
};

} // namespace swp

#endif
